package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiLookupIncludeAutomatically;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

/**
 * 护理计划模版
 */
@Entity
@Table(name = "tnb_nursingplan_serviceitem")
@JsonApiResource(type = "nursingplanitem")
public class NursingPlanServiceItem extends BaseEntity {

	private NursingPlan plan;// 护理方案 废弃
	private Integer startTime;// 服务时间 废弃
	private Integer endTime;// 服务时间 废弃
	private String endTimeTab;// 废弃

	private NursingProjectServiceItem item;// 服务项目

	private String remark;// 备注

	private Integer weekTab;// 周标记

	private String startTimeTab;// 小时标记

	private Customer customer;

	private CustomerNursingPlanModel model;

	private Integer createDateTime;

	private Integer lastUpdateDateTime;// 更新时间

	@Column(name = "createDateTime")
	public Integer getCreateDateTime() {
		return createDateTime;
	}

	public void setCreateDateTime(Integer createDateTime) {
		this.createDateTime = createDateTime;
	}

	@Column(name = "lastUpdateDateTime")
	public Integer getLastUpdateDateTime() {
		return lastUpdateDateTime;
	}

	public void setLastUpdateDateTime(Integer lastUpdateDateTime) {
		this.lastUpdateDateTime = lastUpdateDateTime;
	}

	@Transient
	@JsonApiToOne
	public CustomerNursingPlanModel getModel() {
		return model;
	}

	public void setModel(CustomerNursingPlanModel model) {
		this.model = model;
	}

	@JsonApiToOne
	@JsonApiLookupIncludeAutomatically(overwrite = true)
	@Fetch(FetchMode.JOIN)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "customer_id", foreignKey = @ForeignKey(name = "null"))
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	@Column(name = "starttime_tab")
	public String getStartTimeTab() {
		return startTimeTab;
	}

	public void setStartTimeTab(String startTimeTab) {
		this.startTimeTab = startTimeTab;
	}

	@Column(name = "endtime_tab")
	public String getEndTimeTab() {
		return endTimeTab;
	}

	public void setEndTimeTab(String endTimeTab) {
		this.endTimeTab = endTimeTab;
	}

	@Column(name = "week_tab")
	public Integer getWeekTab() {
		return weekTab;
	}

	public void setWeekTab(Integer weekTab) {
		this.weekTab = weekTab;
	}

	@Column(name = "starttime")
	public Integer getStartTime() {
		return startTime;
	}

	public void setStartTime(Integer startTime) {
		this.startTime = startTime;
	}

	@Column(name = "endtime")
	public Integer getEndTime() {
		return endTime;
	}

	public void setEndTime(Integer endTime) {
		this.endTime = endTime;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "nursingplan_id", foreignKey = @ForeignKey(name = "null"))
	public NursingPlan getPlan() {
		return plan;
	}

	public void setPlan(NursingPlan plan) {
		this.plan = plan;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "serviceitem_id", foreignKey = @ForeignKey(name = "null"))
	public NursingProjectServiceItem getItem() {
		return item;
	}

	public void setItem(NursingProjectServiceItem item) {
		this.item = item;
	}

}